import random
import time

def record_time(func):

    def wrapper(*args, **kwargs):
        start = time.time()
        result = func(*args, **kwargs)
        end = time.time()
        print(f'{func.__name__}:执行时间:{end - start}秒')
        return result
    return wrapper

@record_time
def upload(filename):
    """上传"""
    print(f'开始上传{filename}')
    time.sleep(random.random() * 8)
    print(f'{filename}上传完成')
@record_time
def download(filename):
    """下载"""
    print(f'开始下载{filename}')
    time.sleep(random.random() * 6)
    print(f'{filename}下载完成')


if __name__ == '__main__':
    download('Python从入门到住院.pdf')
    download('北京有点冷.avi')
    upload('数据库从删库到跑路.pdf')